package com.qf.device.mapper;

import com.qf.dto.PageDto;
import com.qf.device.entity.Device;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 设备表 Mapper 接口
 * </p>
 *
 * @author 
 * @since 2023-10-26
 */
@Mapper
public interface DeviceMapper extends BaseMapper<Device> {

    List<Device> findAll(@Param("productId") Long productId,@Param("pageDto") PageDto<Device> pageDto);

    @Select("SELECT\n" +
            "\tqf_device.deleted\n" +
            "FROM\n" +
            "\tqf_device\n" +
            "WHERE\n" +
            "\tqf_device.parent_id = #{productId}")
    List<Device>findByProductId(Long productId);

    Device findOne(@Param("id") Long id);
}
